// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store
const api = {
  /**
	 * 获取船舶调度
	 * @param {Object} params 检索条件的obj
	 */
  reqGetBoat(params) {
    return Service.get(`/${ServiceName}/api/external/shipDispatch/queryall`, { params })
  },
  /**
	 * 获取船舶状态
	 * @param {Object} params 检索条件的obj
	 */
  reqGetBoatStatus(params) {
    return Service.get(`/${ServiceName}/api/external/shipDispatch/getShipDynamicById`, { params })
  },
  /**
   * 新增船舶动态跟踪数据
   */
  reqAddShipDynamic(params) {
    store.commit('changeStatus', true)
    return Service.post(`/${ServiceName}/api/external/shipDispatch/addShipDynamic`, params)
  },
  /**
   * 删除船舶动态
   */
  reqDeleteShipDynamic(params) {
    return Service.delete(`/${ServiceName}/api/external/shipDispatch/deleteShipDynamic`, { params })
  },
  /**
	 * 获取船舶详细信息
	 * @param {Object} params 检索条件的obj
	 */
  reqGetBoatDetail(params) {
    return Service.get(`/${ServiceName}/api/external/mtship/querybyid`, { params })
  },
  /**
	 * 获取航次详细信息
	 * @param {Object} params 检索条件的obj
	 */
  reqGetShipVoyage(params) {
    return Service.get(`/${ServiceName}/api/external/shipvoyage/getshipvoyagebyid`, { params })
  },
  /**
	 * 获取靠离泊计划全部
	 * @param {Object} params 检索条件的obj
	 */
  reqGetAllBerthing(params) {
    return Service.get(`/${ServiceName}/api/external/shipDispatch/getInoutPlan`, { params })
  },
  /**
	 * 根据id获取靠离泊计划
	 * @param {Object} params id:
	 */
  reqGetBerthing(params) {
    return Service.get(`/${ServiceName}/api/external/shipDispatch/getInoutPlanByShipvoyageId`, { params })
  },
  /**
	 * 新建靠离泊计划
	 * @param {Object} params 靠离泊计划的obj
	 */
  reqAddBerthing(params) {
    store.commit('changeStatus', true)
    return Service.post(`/${ServiceName}/api/external/shipDispatch/addInoutPlan`, params)
  },
  /**
	 * 编辑靠离泊计划
	 * @param {Object} params 靠离泊计划的obj
	 */
  reqEditBerthing(params) {
    store.commit('changeStatus', true)
    return Service.post(`/${ServiceName}/api/external/shipDispatch/updateInoutPlan`, params)
  },

  /**
	 * 编辑船舶数据
	 * @param {Object} params 编辑的form
	 */
  reqEditBoat(params) {
    return Service.get(`/${ServiceName}/api/external/shipvoyage/getshipinfobyid`, { params })
  },

  /**
	 * 根据id获取预报数据
	 * @param {Object} params 编辑的form
	 */
  reqEditPrediction(params) {
    return Service.get(`/${ServiceName}/api/external/shipvoyage/getshipvoyagebyid`, { params })
  },
  /**
	 * 删除数据
	 * @param {*} params 数据id
	 */
  reqDelete(params) {
    return Service.delete(`/${ServiceName}/api/external/shipvoyage/deletebyid`, { params })
  }
}
export default api
